Skip to content

iOS: a route a stack is given borrows its insets until UIKit places it - #2500

Merged
ide merged 1 commit into
mainfrom
ide/arriving-route-insets
Dec 1, 2026
Merged

ide merged 1 commit into
mainfrom
ide/arriving-route-insets

Conversation

@ide

@ide ide commented Dec 1, 2026

Copy link
Copy Markdown
Member

Why

On an open iPhone Duo, choosing UI Gallery's Text colors beside Typography for the first time drew its first frame with its paragraphs broken across the 84 pt side strip, then wrapped inside it a frame later. The new route's content was laid out before UIKit placed its controller, with no local insets: its sections pad their scrollers with var(--exact-safe-area-inset-*) (LLP 1123 D9), and reportLocalInsets reports a route's only once its view is in a window. The split writes the detail only after the route's header is lifted into the bar, a covers pass later, and UIKit gives the route its safe area as it places it, so the kernel laid the content out at the wrong width first, painted its text there, and laid it out again; the text's rasters for the right width came a frame after the boxes moved.

How

prepareRoutes records on each route the stack the router gave it (RouteController.arriving). Until UIKit places it there, reportLocalInsets gives the route the local insets of the route that stack shows, which are its column's and the safe area UIKit gives it, so the content lays out where it will rest. LocalInsetsReport.borrowed keeps those apart from a report of UIKit's own, so the route's first measure still takes its landing safe area, as a route with no report does.

Test Plan

On the open iPhone Duo simulator (iOS 27.1), UI Gallery driven with bun scripts/agent.mjs ios --app ui-gallery --chrome platform --timing platform, Typography then Text colors, filmed with simctl io recordVideo in three runs: the first frame of Text colors has its paragraphs and its swatches' samples where they rest, and nothing in the detail moves after it. A probe build showed the content laid out at its final width in the covers pass before UIKit places the route, its text painted once at that width as it appears, and no width change from UIKit's measure. perf during "tap sidebar-textcolors" counts 814 node layouts where it counted about 1,400 to 1,540, and 7 kernel layouts, as before.

bun host/apple/build.mjs --test --ios --only LocalInsetsIOSTests,SplitIOSTests,ScrollInsetsIOSTests passes but for SplitIOSTests.testAnInstallTheRunnerCannotAnswerAsksAgain, which fails on main too. bun scripts/gate.mjs passes. No test of its own: a hosted XCTest loses the Duo's hinge, and a window larger than the screen gives the detail other insets than the open Duo does, so the case is verified on the simulator as above.

Why
===

On an open iPhone Duo, choosing UI Gallery's Text colors beside Typography for the first time drew its first frame with its paragraphs broken across the 84 pt side strip, then wrapped inside it a frame later. The new route's content was laid out before UIKit placed its controller, with no local insets: its sections pad their scrollers with `var(--exact-safe-area-inset-*)` (LLP 1123 D9), and `reportLocalInsets` reports a route's only once its view is in a window. The split writes the detail only after the route's header is lifted into the bar, a covers pass later, and UIKit gives the route its safe area as it places it, so the kernel laid the content out at the wrong width first, painted its text there, and laid it out again; the text's rasters for the right width came a frame after the boxes moved.

How
===

`prepareRoutes` records on each route the stack the router gave it (`RouteController.arriving`). Until UIKit places it there, `reportLocalInsets` gives the route the local insets of the route that stack shows, which are its column's and the safe area UIKit gives it, so the content lays out where it will rest. `LocalInsetsReport.borrowed` keeps those apart from a report of UIKit's own, so the route's first measure still takes its landing safe area, as a route with no report does.

Test Plan
=========

On the open iPhone Duo simulator (iOS 27.1), UI Gallery driven with `bun scripts/agent.mjs ios --app ui-gallery --chrome platform --timing platform`, Typography then Text colors, filmed with `simctl io recordVideo` in three runs: the first frame of Text colors has its paragraphs and its swatches' samples where they rest, and nothing in the detail moves after it. A probe build showed the content laid out at its final width in the covers pass before UIKit places the route, its text painted once at that width as it appears, and no width change from UIKit's measure. `perf during "tap sidebar-textcolors"` counts 814 node layouts where it counted about 1,400 to 1,540, and 7 kernel layouts, as before.

`bun host/apple/build.mjs --test --ios --only LocalInsetsIOSTests,SplitIOSTests,ScrollInsetsIOSTests` passes but for `SplitIOSTests.testAnInstallTheRunnerCannotAnswerAsksAgain`, which fails on main too. `bun scripts/gate.mjs` passes. No test of its own: a hosted XCTest loses the Duo's hinge, and a window larger than the screen gives the detail other insets than the open Duo does, so the case is verified on the simulator as above.
@ide
ide merged commit 098ce0c into main Dec 1, 2026
2 checks passed
@ide
ide deleted the ide/arriving-route-insets branch December 1, 2026 12:03
ide added a commit that referenced this pull request Dec 1, 2026
Why
===

`exact share` published UI Gallery 0.1.1 (35) to its AppDrop link, built from main at `098ce0cbb7`, which has a split's newly chosen detail lay its content out at its column's insets from its first frame on an open iPhone Duo (#2500). Investigating it found five things worth doing that it did not do.

How
===

`app.json`'s `buildNumber` is 35, the build the link holds, so the next share that builds takes 36. `QUEUE.md` gains five entries: a paragraph a batch resizes shows its old raster until the scroll pump's next frame; a new symbol's intrinsic size costs a kernel layout after the batch that makes it; `host-scrollers.test.mjs` fails since the scroll lock's rule; `SplitIOSTests.testAnInstallTheRunnerCannotAnswerAsksAgain` crashes the test process on main; and an HDR picture glows inside its own scroller only on a layer of its own.

Test Plan
===

`bun scripts/share.mjs --app ui-gallery --force` (the link was last published from another branch) printed the link and wrote 35.
ide added a commit that referenced this pull request Dec 1, 2026
Why
===

`exact share` published UI Gallery 0.1.1 (35) to its AppDrop link, built
from main at `098ce0cbb7`, which has a split's newly chosen detail lay
its content out at its column's insets from its first frame on an open
iPhone Duo (#2500). Investigating it found five things worth
doing that it did not do.

How
===

`app.json`'s `buildNumber` is 35, the build the link holds, so the next
share that builds takes 36. `QUEUE.md` gains five entries: a paragraph a
batch resizes shows its old raster until the scroll pump's next frame; a
new symbol's intrinsic size costs a kernel layout after the batch that
makes it; `host-scrollers.test.mjs` fails since the scroll lock's rule;
`SplitIOSTests.testAnInstallTheRunnerCannotAnswerAsksAgain` crashes the
test process on main; and an HDR picture glows inside its own scroller
only on a layer of its own.

Test Plan
===

`bun scripts/share.mjs --app ui-gallery --force` (the link was last
published from another branch) printed the link and wrote 35.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant